{extend name="base"}
{block name="content"}
	<script>
	KindEditor.ready(function(K) {
		var uploadbutton = K.uploadbutton({
			button : K('#uploadButton')[0],
			fieldName : 'imgFile',
			url : '{:url("Slide/upload")}',
			afterUpload : function(data) {
				if (data.error === 0) {
					var url = K.formatUrl(data.url, 'absolute');
							K('#url').val(url);
							$('#show_thumb').attr('src',url).show();
						} else {
							alert(data.message);
						}
					},
					afterError : function(str) {
						alert('自定义错误信息: ' + str);
					}
			});
			uploadbutton.fileBox.change(function(e) {
			uploadbutton.submit();
		});
	});
</script>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:url('Ad/index')}">网站广告</a></li>
			<li class="active"><a href="{:url('Ad/add')}">添加广告</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form" action="{:url('Ad/add')}">
			<fieldset>
				
				<div class="control-group">
					<label class="control-label">广告名称</label>
					<div class="controls">
						<input type="text" name="ad_name">
						<span class="form-required">*</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">广告代码</label>
					<div class="controls">
						<textarea name="ad_content" rows="5" cols="57"></textarea>
					</div>
				</div>
			</fieldset>
			<div class="form-actions">
				<button class="btn btn-primary js-ajax-submit" type="submit">添加</button>
				<a class="btn" href="javascript:history.back(-1);">返回</a>
			</div>
		</form>
	</div>
	<script src="__THEMES__/js/common.js"></script>
{/block}